import util from '@util'
export default {
  state: {
    token: util.getItem('$xj_token') || '',
    user: {},
    loggedIn: util.getItem('$xj_token') ? true : false,
    taskInfoDialog: {
      visible: false,
      row: {}
    },
    loginDialog: {
      visible: false
    },
    publishTaskDialog: {
      visible: false
    },
    userDrawer: {
      visible: false
    }
  },
  mutations: {
    setTaskInfoDialog (state, taskInfoDialog) {
      state.taskInfoDialog = taskInfoDialog
    },
    setUser (state, user) {
      state.user = user
    },
    setToken (state, token) {
      state.token = token
    },
    setPublishTaskDialog (state, publishTaskDialog) {
      state.publishTaskDialog = publishTaskDialog
    },
    setUserDrawer (state, userDrawer) {
      state.userDrawer = userDrawer
    },
    setLoggedIn (state, loggedIn) {
      state.loggedIn = loggedIn
    },
    setLoginDialog (state, loginDialog) {
      state.loginDialog = loginDialog
    }
  }
}
